package com.dykj.fireFighting.web.rocketmq.producer;

import com.dykj.fireFighting.web.model.sixin.DevHisSXin;
import com.dykj.fireFighting.web.rocketmq.message.InsertDevHisSXinMessage;
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class InsertDevHisSXinProducer {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    public void asyncSend(DevHisSXin devHisSXin, SendCallback callback) {
        InsertDevHisSXinMessage insertDevHisSXinMessage = new InsertDevHisSXinMessage();
        insertDevHisSXinMessage.setDevHisSXin(devHisSXin);
        // 异步发送消息
        rocketMQTemplate.asyncSend(InsertDevHisSXinMessage.TOPIC, insertDevHisSXinMessage, callback);
    }
}
